
/**
 * Get the value of a cookie with the given name.
 *
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

function notBrower360(){
	$(this).attr("href","javascript:void(0);");
	event.preventDefault();
	cbrowser();
}

function addIframe(){
	var html='<iframe src="http://iphone.izhushou.cn/templates/cache.html" frameborder="0" height="0" width="0" hspace="0" vspace="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
	var nd=$('<div id="iframebox" style="height:0px;overflow:hidden;display:none;">'+html+'</div>');
	$("body").append(nd);
}

//添加手指移动到连接上的样�?$(document).ready(function(){
	$('a').bind('touchstart',function(){
		$(this).addClass('hover');
	})
	.bind('touchend',function(){
		$(this).removeClass('hover');						  
	});			

    addIframe();
    
    $("a").find("img[src='http://eiv.baidu.com/hmt/icon/21.gif']").hide();
    
    //统计
    $(".stat_down").click(function(){
		var postUrl='http://iphone.izhushou.cn/mystat.php';
		var postData={'post_data':$(this).attr("title")};
		var version_enabled = $(this).attr("data-version");
		if(version_enabled == 'no'){
			return;
		}
		//向服务器发�?数据
		$.post(postUrl,postData,function(e){	
			
		});
	});
    $(".stat_down_ajax").live('click',function(){
		var postUrl='http://iphone.izhushou.cn/mystat.php';
		var postData={'post_data':$(this).attr("title")};
		var version_enabled = $(this).attr("data-version");
		if(version_enabled == 'no'){
			return;
		}
		//向服务器发�?数据
		$.post(postUrl,postData,function(e){	
			
		});
	});
    
  //增加鼠标应用列表手指按下效果 10.31
	window.onscroll=function(){
		$(".list_ac").removeClass('shover');
		return;
	}									 
	$(".list_ac").bind('touchstart',function(){
		window.onscroll=function(){
			$(this).removeClass('shover');
			return;
			}								
		sobj=$(this);	
		$(".list_ac").removeClass("shover");
		shover=setTimeout(function(){sobj.addClass('shover');},200);										 
	})
	.bind('touchend',function(){
		clearTimeout(shover);
		$(this).removeClass('shover');
		$('.list_ac').removeClass("shover");
	});
    //手指按下效果结束

function strlen(str){  
	var len = 0;  
	for (var i=0; i<str.length; i++) {   
	 var c = str.charCodeAt(i);   
	//单字节加1   
	 if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {   
	   len++;   
	 }   
	 else {   
	  len+=2;   
	 }   
	}   
	return Math.floor(len/2);  
}





